//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类;

public class demo_1534 {
    public demo_1534() {
    }

    public int countGoodTriplets(int[] arr, int a, int b, int c) {
        int count = 0;

        for(int j = 1; j <= arr.length - 2; ++j) {
            for(int i = 0; i < j; ++i) {
                if (Math.abs(arr[i] - arr[j]) <= a) {
                    for(int k = j + 1; k <= arr.length - 1; ++k) {
                        if (Math.abs(arr[j] - arr[k]) <= b && Math.abs(arr[i] - arr[k]) <= c) {
                            ++count;
                        }
                    }
                }
            }
        }

        return count;
    }
}
